package com.baomidou.springwind.pojo;

import com.baomidou.springwind.entity.NetworkNode;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * <p>
 * 驾驶距离
 * </p>
 *
 * @Author demo
 * @Date 2017-7-3
 */
public class DrivingRoute implements Serializable {
    public final NetworkNode node1;
    public final NetworkNode node2;
    public final Long distance;
    public final Long duration;

    public DrivingRoute(NetworkNode node1,NetworkNode node2, Long distance, Long duration) {
        this.node1 = node1;
        this.node2 = node2;
        this.distance = distance;
        this.duration = duration;
    }

    @Override
    public String toString() {
        return "DrivingRoute{" +
                "node1=" + node1 +
                ", node2=" + node2 +
                ", distance=" + distance +
                ", duration=" + duration +
                '}';
    }

    public boolean isPath(NetworkNode node1,NetworkNode node2) {
        if(this.node1.getId().equals(node1.getId()) && this.node2.getId().equals(node2.getId())){
            return true;
        }
        if(this.node1.getId().equals(node2.getId()) && this.node2.getId().equals(node1.getId())){
            return true;
        }
        return false;
    }
}
